# -*- coding: utf-8 -*-
# @Time:2021/08/06 23:46
# @Author:Cindy
from typing import List
import pytest
import requests


def pytest_collection_modifyitems(session, config, items: List):
    print("这是收集所有测试用例的方法")
    print(items)
    for item in items:
        data = {'nodeid': item.nodeid, 'remark': item.name}
        requests.post("http://127.0.0.1:5000/testcase", json=data)

    # items.reverse()
    # for item in items:
    #     item.name = item.name.encode('utf-8').decode('unicode-escape')
    #     item._nodeid = item.nodeid.encode('utf-8').decode('unicode-escape')
    #
    #     if "search" in item.name:
    #         item.add_marker(pytest.mark.search)
    #     elif "add" in item.name:
    #         item.add_marker(pytest.mark.add)
